<?php 
	class Db_channel extends CI_Model{
		public function __construct(){
			parent::__construct();
		}
		
		public function listAll(){
				$config['base_url'] = base_url().'manage_channel/channellist';
				$config['total_rows'] = $this->db->count_all("mobile_p_tv_info");
				$config['per_page'] = 20;
				$config['full_tag_open'] = '<div class="pages">';
				$config['full_tag_close'] = '<div>';
				$this->pagination->initialize($config);
				$this->db->from("mobile_p_tv_info t1");
				$this->db->join("mobile_p_tv_class t2", "t1.TVClass=t2.pkid","left");
				//$this->db->where("t1.status",1);
				//$this->db->limit($config['per_page'],$this->uri->segment(3));
				$this->db->order_by("t1.TVID", "DESC");
				$res = $this->db->get();
				//==
				$no = $this->uri->segment(3)+1;
				$i = 1;
				$arr = $res->result_array();
				$item = array();
				foreach ($arr as $P){
					if($i %2 == 0)
						$tmp['back']							="#FFFFFF";
					else
						$tmp['back']							="#F4F4F4";
					$i++;
					$tmp['no']							=$no;
					$tmp['pkid']						=$P['TVID'];
					$tmp['TVName']					=$P['TVName'];
					$tmp['name']						=$P['name_en'];
					$item[] = $tmp;
					$no = $no+1;
				}
				$num_row = $config['total_rows'];
				$pagelink  = $this->pagination->create_links();
				return array($item,$num_row,$pagelink,$config['total_rows']);
			}
	}
?>